package com.nulgame.bukkit.plugin.responsebuilder;

import com.nulgame.bukkit.plugin.model.AntiSpamConfiguration;

public class ResponseBuilderFactory {
	private AntiSpamConfiguration m_configuration;
	public ResponseBuilderFactory(AntiSpamConfiguration config){
		m_configuration = config;
	}
	public ResponseBuilder createAntiSpamResponseBuilder(String playerName, String message){
		String responseFormat = m_configuration.antiChatSpam.responseToPlayer;
		Integer allowedInf = m_configuration.antiChatSpam.allowedInfraction;
		Long inMillisTime = m_configuration.antiChatSpam.inMillisTime; 
		return new AntiChatSpamResponseBuilder(responseFormat, playerName, message, allowedInf, inMillisTime);
	}
	public ResponseBuilder createAntiChatOverFlowResponseBuilder(String playerName, String message) {
		String reponseFormat = m_configuration.antiChatOverFlow.responseToPlayer;
		Long inMillisTime = m_configuration.antiChatOverFlow.inMillisTime;
		return new AntiChatOverFlowResponseBuilder(reponseFormat, playerName, message, inMillisTime);
	}
	public ResponseBuilder createAntiWordResponseBuilder(String playerName, String message, String word) {
		String reponseFormat = m_configuration.antiWord.responseToPlayer;
		return new AntiWordResponseBuilder(reponseFormat, playerName, message, word);
	}
	public ResponseBuilder createAntiWordCapResponseBuilder(String playerName, String message) {
		String reponseFormat = m_configuration.antiWordCap.responseToPlayer;
		Long percentage = m_configuration.antiWordCap.allowedPercentage.longValue();
		return new AntiWordCapResponseBuilder(reponseFormat, playerName, message, percentage);
	}
	
	public ResponseBuilder createAntiIPAddressResponseBuilder(String playerName, String message, String ip) {
		String reponseFormat = m_configuration.antiIPAddress.responseToPlayer;
		return new AntiIPAddressResponseBuilder(reponseFormat, playerName, message, ip);
	}
	
	public ResponseBuilder createAntiServerAddressResponseBuilder(String playerName, String message, String serverAddress) {
		String reponseFormat = m_configuration.antiServerAddress.responseToPlayer;
		return new AntiServerAddressResponseBuilder(reponseFormat, playerName, message, serverAddress);
	}
}
